/* -----------------------------------------------------------
 * Author: Maria Powell
 * Testing Function:Council_Room()
 * Function Description: This card implements the council_room
 * 						 card:
 * 						 - add 4 cards
 * 						 - add 1 buy
 * What to test: This test will ensure that 4 cards are added to 
 * 				 the hand deck and that 1 point is added for buy.
 * How to test:  I will set up the game state properly to check 
 * 				 that 4 cards will be added and 1 point added for
 * 				 buy.
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

//Set NOISY test to 0 to remove printfs from output console
#define NOISY_TEST 1

int main()
{
	//Initialization
	int i = 0;
	int seed = 1000;
	int numPlayers = 2;
	int firstPlayer = 0;
	int secondPlayer = 1;
	int currentHandCount = 0;
	int shouldBeHandCount = 0;
	int currentNumBuy = 0;
	int shouldBeNumBuy = 1;
	int addFourCards = 4;
	int toHand = 2;
	int handPos = 0;
	int notNeeded = 0;
	int k[10] = {adventurer, council_room, feast, gardens, mine,	
		 		 remodel, smithy, village, baron, great_hall};
	struct gameState G;

	printf("TESTING  playCouncilRoom()\n");
	#if (NOISY_TEST == 1)
		printf("Initializing gameState...\n");
	#endif

	//set gameState
	memset(&G, 23, sizeof(struct gameState));
	initializeGame(numPlayers, k, seed, &G);
	
	//start tracking hand counts
	currentHandCount = G.handCount[firstPlayer];
	shouldBeHandCount = currentHandCount + addFourCards;

	//start tracking num buys
	currentNumBuy = G.numBuys;
	shouldBeNumBuy = currentNumBuy + 1;

	//add council room card to hand deck
	gainCard(council_room, &G, toHand, firstPlayer);

	//set council room hand position
	for(i = 0; i < MAX_HAND; i++)
	{
		if(G.hand[firstPlayer][i] == council_room)
		{
			handPos = i;
		}
	}

	//play council room card
	//playCouncilRoom(firstPlayer, &G, handPos);
	cardEffect(council_room, notNeeded, notNeeded, notNeeded, &G, handPos, &notNeeded);
	assert(G.handCount[firstPlayer] == shouldBeHandCount);	
	assert(G.numBuys == shouldBeNumBuy);

	printf("Unit Test Passed\n");
	return 0;
}
